<form class="form-horizontal form-main" action="" method="post" enctype="multipart/form-data" accept-charset="utf-8">
	<div class="control-group">
		<h2 class="form-signin-heading">Thông tin giảng viên</h2>
	</div>
	<?php if(isset($message) and $message){?>
	<div class="alert alert-error" style="text-align: center;">
	<?php echo $message;?>
	</div>
	<?php } ?>
	
	<?php if($this->session->flashdata('message')){?>
	<div class="alert alert-error" style="text-align: center;">
		<?php $mess = $this->session->flashdata('message');
			foreach($mess as $v){ echo $v."<br />"; }
		?>
	</div>
	<?php } ?>

	<div class="control-group">
		<label class="control-label">
			<img src="<?php echo base_url().'loadimage';?>" class="img-polaroid" align="left"> 
		</label>
		<div class="controls">
			<label>Ảnh </label>
			<input type="file" name="image" size="20" />
		</div>
	</div>
	<div class="control-group <?php if(form_error('name')) echo ' error';?>">
		<label class="control-label">Họ và tên </label>
		<div class="controls">
			<input type="text" name="name" value="<?php echo $info['name'];?>" />
			<?php echo form_error('name', '<div style="color:#B94A48;">', '</div>'); ?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">Ngày sinh </label>
		<div class="controls">
			<input type="text" name="birthday" class="datepicker"
				value="<?php echo date('d/m/Y', strtotime($info['birthday']));?>" />
		</div>
	</div>
	<div class="control-group <?php if(form_error('seniority')) echo ' error';?>">
		<label class="control-label">Thâm niên giảng dạy </label>
		<div class="controls">
			<input type="text" name="seniority" value="<?php echo $info['seniority'];?>" /> (năm)
			<?php echo form_error('seniority', '<div style="color:#B94A48;">', '</div>'); ?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">Chức danh </label>
		<div class="controls">
			<?php echo form_dropdown('position', $chucdanh['option'], $chucdanh['selected_value']);?>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">Trình độ chuyên môn </label>
		<div class="controls">
			<?php echo form_dropdown('qualification', $qualification['option'], $qualification['selected_value']);?>
		</div>
	</div>

	<div class="control-group">
		<ul class="nav nav-tabs" id="myTab" style="margin-bottom:0px">
			<li><a href="#tab1" data-toggle="tab">Bài báo</a></li>
			<li><a href="#tab2" data-toggle="tab">Công Trình</a></li>
			<li><a href="#tab3" data-toggle="tab">Giáo trình</a></li>
			<li><a href="#tab4" data-toggle="tab">Hướng dẫn thạc sĩ/tiến sĩ</a></li>
		</ul>
		<div class="tab-content" style="border-bottom:1px solid #DDDDDD;border-left:1px solid #DDDDDD;border-right:1px solid #DDDDDD;padding:10px 5px 10px 5px;">
			<div class="tab-pane" id="tab1">
				<table class="table table-hover">
					<thead>
					<tr>
						<th> # </th>
						<th> Tên bài báo </th>
						<th></th>
					</tr>
					</thead>
					<?php foreach($baibao as $k => $v){?>
					<tr class='<?php echo $k+1;?>'>
						<td><?php echo $k+1;?></td>
						<td><input type="text" value="<?php echo $v->ten;?>" name="baibao[]" class="input-xlarge" maxlength="500"></td>
						<td><?php if($k != '0') {?><a href="#" onclick="form.deleteRow('tab1','<?php echo $k+1;?>');return false;" class="close">&times;</a><?php }?></td>
					</tr>
					<?php }?>
					<tr>
						<td></td>
						<td><a class="btn btn-small btn-primary" onclick="form.addRow('tab1');return false;" type="button">Thêm</a></td>
						<td></td>
					</tr>
				</table>
			</div>
			<div class="tab-pane" id="tab2">
				<table class="table table-hover">
					<thead>
					<tr>
						<th> # </th>
						<th>Tên công trình </th>
						<th></th>
					</tr>
					</thead>
					<?php foreach($congtrinh as $k => $v){?>
					<tr class='<?php echo $k+1;?>'>
						<td><?php echo $k+1;?></td>
						<td><input type="text" value="<?php echo $v->ten;?>" name="congtrinh[]" class="input-xlarge" maxlength="500"></td>
						<td><?php if($k != '0') {?><a href="#" onclick="form.deleteRow('tab2','<?php echo $k+1;?>');return false;" class="close">&times;</a><?php }?></td>
					</tr>
					<?php }?>
					<tr>
						<td></td>
						<td><a class="btn btn-small btn-primary" onclick="form.addRow('tab2');return false;" type="button">Thêm</a></td>
						<td></td>
					</tr>
				</table>
			</div>
			<div class="tab-pane" id="tab3">
				<table class="table table-hover">
					<thead>
					<tr>
						<th> # </th>
						<th>Tên Giáo trình </th>
						<th></th>
					</tr>
					</thead>
					<?php foreach($giaotrinh as $k => $v){?>
					<tr class='<?php echo $k+1;?>'>
						<td><?php echo $k+1;?></td>
						<td><input type="text" value="<?php echo $v->ten;?>" name="giaotrinh[]" class="input-xlarge" maxlength="255"></td>
						<td><?php if($k != '0') {?><a href="#" onclick="form.deleteRow('tab3','<?php echo $k+1;?>');return false;" class="close">&times;</a><?php }?></td>
					</tr>
					<?php }?>
					<tr>
						<td></td>
						<td><a class="btn btn-small btn-primary" onclick="form.addRow('tab3');return false;" type="button">Thêm</a></td>
						<td></td>
					</tr>
				</table>
			</div>
			<div class="tab-pane" id="tab4">
				<table class="table table-hover">
					<thead>
					<tr>
						<th> # </th>
						<th>Nghiên cứu sinh/học viên</th>
						<th>Luận án/luận văn</th>
						<th>Từ ngày</th>
						<th>Đến ngày</th>
						<th></th>
					</tr>
					</thead>
					<?php foreach($huongdan as $k => $v){?>
					<tr class="<?php echo $k+1;?>">
						<td><?php echo $k+1;?></td>
						<td><input type="text" value="<?php echo $v->hoten;?>" name="huongdan[<?php echo $k+1;?>][hoten]" class="input-medium" maxlength="100"></td>
						<td><input type="text" value="<?php echo $v->detai;?>" name="huongdan[<?php echo $k+1;?>][detai]" class="input-medium" maxlength="255"></td>
						<td><input type="text" value="<?php echo ($v->from)?date('d/m/Y',$v->from):'';?>" name="huongdan[<?php echo $k+1;?>][from]" class="input-medium datepicker2"></td>
						<td><input type="text" value="<?php echo ($v->to)?date('d/m/Y',$v->to):'';?>" name="huongdan[<?php echo $k+1;?>][to]" class="input-medium datepicker2"></td>
						<td><?php if($k != '0') {?><a href="#" onclick="form.deleteRow('tab4','<?php echo $k+1;?>');return false;" class="close">&times;</a><?php }?></td>
					</tr>
					<?php }?>
					<tr>
						<td></td>
						<td><a class="btn btn-small btn-primary" onclick="form.addRow('tab4');return false;" type="button">Thêm</a></td>
						<td></td>
						<td></td>
						<td></td>
						<td></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<script>
		$(function () {
			$('#myTab a:first').tab('show');
		});
	</script>
	
	<div class="control-group">
		<div class="controls">
			<button name="save" value="1" type="submit" class="btn">Lưu lại</button>
			<button name="cancel" value="1" type="submit" class="btn">Không lưu</button>
		</div>
	</div>
</form>
